<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<!DOCTYPE html>
<html>
<head>
    <title>蓝科权限管理系统</title>
    <link rel="shortcut icon" type="image/x-icon" href="../../assets/favicon.ico" />
    <script type="text/javascript" src="../../assets/easyui/plugin/baseloading.js"></script>
    <link rel="stylesheet" type="text/css" href="../../assets/easyui/themes/bootstrap/easyui.css">
    <link rel="stylesheet" type="text/css" href="../../assets/easyui/themes/icon.css">
    <script type="text/javascript" src="../../assets/easyui/jquery.min.js"></script>
    <script type="text/javascript" src="../../assets/easyui/jquery.easyui.min.js"></script>
    <script type="text/javascript" src="../../assets/easyui/plugin/portal/jquery.portal.js"></script>
    <script type="text/javascript" src="../../assets/easyui/plugin/easyui.resize.js"></script>
    <link rel="stylesheet" type="text/css" href="../../assets/easyui/plugin/portal/portal.css">
    <link rel="stylesheet" type="text/css" href="../../assets/style.css">
    <script type="text/javascript" src="../../assets/easyui/easyui-lang-zh_CN.js"></script>
    <link rel="stylesheet" type="text/css" href="../../assets/easyui/plugin/texteditor/texteditor.css">
    <script type="text/javascript" src="../../assets/easyui/plugin/texteditor/jquery.texteditor.js"></script>
</head>
<body id="layout_body" class="easyui-layout">
<div data-options="region:'west',split:true,collapsible:false" style="width:180px;">
    <table id="admin_info">
        <tr>
            <td rowspan="2"><img src="../../assets/images/user.png" style="width: 50px;height: 50px;" /></td><td><strong>超级管理员</strong></td>
        </tr>
        <tr>
            <td>
                <span class="left">
                    <a href="../../shiro/site/logout.action">退出</a>
                </span>
                <span class="right">
                    <shiro:hasPermission name="user_resetpassword">
                        <a href="javascript:loadWin('个人配置','../../shiro/site/config.action')">配置</a>
                    </shiro:hasPermission>
                </span>
            </td>
        </tr>
    </table>
    <div class="easyui-accordion"  data-options="fit:false,animate:false" >
        <c:forEach items="${menus}" var="menu">
            <shiro:hasPermission name="${menu.menupermission}">
            <div title="${menu.menutext}" class="menu_accordion" style="padding:8px;">
                <ul>
                    <c:forEach items="${menu.menuItems}" var="menuitem">
                        <shiro:hasPermission name="${menuitem.menuitempermission}">
                        <li><a href="javascript:showTab('${menuitem.menuitemtext}','${menuitem.menuitemurl}')">${menuitem.menuitemtext}</a></li>
                        </shiro:hasPermission>
                    </c:forEach>
                </ul>
            </div>
            </shiro:hasPermission>
        </c:forEach>
    </div>
</div>
<div data-options="region:'center',border:false">
    <div id="win_main" class="easyui-window" title=""
         data-options="modal:true,closed:true" style="padding: 10px;">
    </div>
    <div id="win_main_2" class="easyui-window" title=""
         data-options="modal:true,closed:true">
    </div>
    <div class="easyui-tabs"  data-options="fit:'true'"  id="sys_tab"  >

    </div>
</div>
<script>
    $(function(){
        $('#sys_tab').tabs('add',{
            'title':'控制台',
            'href':'../../shiro/site/console.action'
        });
        $('#layout_body').layout('hidden','east');
//        $('#layout_body').layout('unsplit','east');
        $(".menu_accordion").find("ul li").bind("click",function () {
            //将其他的样式背景的active处理掉，然后在当前的li上面加上active
            $(".menu_accordion").find("ul li").removeClass("checkactive");
            $(this).closest("li").addClass("checkactive");
        });
    });
    function showTab(title,url) {
        var tab = $('#sys_tab').tabs('getTab',title);
        if(tab!=null){
            $('#sys_tab').tabs('select',title);
        }else{
            $('#sys_tab').tabs('add',{
                'title':title,
                'href':url,
                'closable':true
            });
            $('#layout_body').layout('hidden','east');
        }
    }
    function layoutresize() {
        $("body").onresize(function () {
            $('#layout_body').layout("resize");
        });
    }
    function loadWin(title,url) {
        $('#win_main').window({
            width:$(window).width()*0.618,
            height:$(window).height()*0.618,
            modal:true,
            title:title,
            href:url,
            collapsible:false,
            minimizable:false,
            maximizable:false
        });
        $('#win_main').window('center');
        $('#win_main').window('open');
    }
    function loadWin2(title,url) {
        $('#win_main_2').window({
            width:$(window).width()*0.618*0.618,
            height:$(window).height()*0.618*0.618,
            modal:true,
            title:title,
            href:url,
            collapsible:false,
            minimizable:false,
            maximizable:false
        });
        $('#win_main_2').window('center');
        $('#win_main_2').window('open');
    }
</script>
</body>
</html>
